import 'reflect-metadata';
import express from 'express';
import session from 'express-session';

import './controller/UserController';

import { router } from './util/router';
const app = express();

app.use(
  session({
    secret: 'cookeid123456',
    name: 'cookieinfo',
    resave: false,
    saveUninitialized: true,
  })
);

// 中间件
// express 4.16+后，处理表单数据的url集成到了express 框架中
app.use(express.urlencoded({ extended: true }));
app.use(router);

app.get('/', (req, res) => {
  res.send('hello word5003-2');
});
app.listen(5003, () => {
  console.log(`Server running at http://localhost/`);
});
